package com.shura.ssm.mapper;

import com.shura.ssm.common.entity.User;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * UserMapper
 * Created by shura
 * Date：2017/9/3
 * Time：16:19
 */
public interface UserMapper {

    /**
     * 根据id查询用户
     *
     * @param id
     * @return
     * @throws Exception
     */
    public User queryById(@Param("id")Integer id)throws Exception;

    /**
     * 新增用户
     *
     * @param user
     * @throws Exception
     */
    public void newUser(@Param("user") User user) throws Exception;

    /**
     * 修改用户
     *
     * @param user
     * @throws Exception
     */
    public void update(@Param("user") User user) throws Exception;

    /**
     * 删除用户
     *
     * @param id
     * @throws Exception
     */
    public void deleteById(@Param("id") int id) throws Exception;

    /**
     * 查询所有用户
     *
     * @return
     * @throws Exception
     */
    public List<User> listAll() throws Exception;

    /**
     * 统计用户名与密码相同的数量
     *-
     * @param userName
     * @param password
     * @return
     * @throws Exception
     */
    public int countByUserNameAndPassword(@Param("userName") String userName,
                                          @Param("password") String password) throws Exception;
}
